perm filename UXGP.REG[UP,DOC] blob sn#137789 filedate 1974-12-30 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00006 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002		User Programming for the XGP
C00010 00003		Character Mode for the XGP
C00021 00004		XGP MTAPE UUO
C00026 00005		XGP error reporting.
C00030 00006	     	XGPUUO	UUO
C00033 ENDMK
C⊗;
	User Programming for the XGP

	This  document reflects  the  state  of  the software  as  of
system 6.13/P.   Changes may be made without prior notice and without
maintaining compatability with earlier systems.

	The Xerox Graphics  Printer (XGP) provides a means  of making
a hardcopy listing  of virtually any drawing that can be expressed as
a one-bit raster.   The XGP  accepts as data  a bit array  describing
each  scan-line that  is printed.   Each  scan line  is approximately
1700 bits;  scan lines  are spaced at  about 200  per inch along  the
paper.   A picture is  built by sending successive  scan lines to the
XGP.

	There are presently two distinct modes  of operating the XGP,
video mode and character mode.

	Video Mode

	In video mode,  36 bit words  are interpreted as  video data.
Words  are grouped together into  portions of a scan-line  by the use
of a Group Command Word (GCW).  The GCW precedes the data  portion of
the group.  The GCW specifies how  many words of video data are to be
found  in this  group.   Also  the GCW  allows the  video data  to be
positioned anywhere along  the scan  line.  The  exact format of  the
GCW is:

	BYTE (1)MARK (11)LNSKIP (12)COLSKP (6)UNUSED, DWCNT

	The fields of the GCW are interpreted as follows:

	The  paper will  be advanced  by  LNSKIP blank  lines
	before  printing.   LNSKIP =  1  is used  for normal,
	single spacing. LNSKIP  = 0  prevents any advance  to
	the next  scan line  and prints on  the same  line as
	the last group.

	The column register in the XGP  interface will be set
	to COLSKP before transmitting data. 

	DWCNT words following the GCW will  be transmitted to
	the  XGP as  video data  (a bit  = 0  is white,  1 is
	black). If DWCNT = 0 then there are no data words  in
	this group and the next word is another GCW.

	After data is sent,  if the MARK bit is  1, the paper
	will  be marked  for cutting.   Paper cutting  is not
	exact so a MARK  should be preceeded and followed  by
	several blank lines.

	The field  labeled UNUSED  has no  meaning currently.
	It  should be set to zero  to avoid confusion if some
	other meaning is attached to this field.


	
	Modes 17  and 117  are used  for video  data.   All of  these
modes accept the format that is described above.

	In mode 17,  the effective address of the OUT uuo points to a
standard dump  mode command  list.   The command  list specifies  the
data  to send  to the  XGP.   Each  OUT  will wait  until the  entire
command  list is processed before  returning to the  user.  The paper
will be cut at the completion of each command list.  

	Mode 117 is like mode  17 except that the OUT uuo  returns to
the user while data is being  sent to the XGP.  In this mode the user
can overlap the input of one  data block with the output of  another.
Three data blocks are  needed in this mode: one being  emptied by the
XGP, another  pending, and another being filled  by the user program.
The first two  OUT uuos will  return immediately (having  established
the current  and pending output  blocks).   After the user  fills his
third block  and gives an OUT uuo he will be forced to wait until the
current block  is  empty (at  which time  the  pending block  becomes
current and  the  block specified  in this  OUT will  become the  new
pending block).   When the third OUT returns, the first block will be
free to use.  In  video mode the XGP  requires up to 10,000 words  of
data per second.   Care should be exercised in  programming to always
have data ready for the XGP.

	Another requirement  of mode  117 is  that the command  lists
that  point to the  three data blocks  must be disjoint.   The actual
requirement is that  the command list  for each  block must be  valid
while the block is  being output.  In particular, don't  use the same
physical location in your program for more than one command list.

	In mode 117 you must do a CLOSE UUO  after the last OUTPUT to
force  the transmission of  all buffers to  the XGP.   It is possible
that a user  program may not be  able to supply  data fast enough  in
mode 117.  In this event,  the output will  be cut wherever  the data
runs  out.  A status bit, 2000  (IOTEND), is provided which warns the
program that this  has occurred.   This bit is  set only in mode  117
when the data runs out and no CLOSE has been done.

	Character Mode for the XGP

	Modes 0 and 13 are the character modes in  the XGP.  In these
modes,  36 bit words are  interpreted as five 7-bit  bytes.  There is
no fixed mapping between byte values and particular  graphic symbols.
The graphic  symbol for any  byte is defined  by the current  font in
use.  Certain  byte  values have  special  meanings  consistient with
ASCII and  one byte  value, octal  177, is  used as  an escape  which
gives the bytes that follow a special meaning.

	Character  mode  permits vectors  and  multiple  active  text
lines.

	Character mode interprets  7-bit bytes taken from  the user's
buffer as follows:

Byte	Usual meaning			Escape significance

0	Null - byte is ignored		Normal
1	Normal				XGP ESCAPE 1
2	Normal				XGP ESCAPE 2
3	Normal				XGP ESCAPE 3
4	Normal				XGP ESCAPE 4
5-10	Normal				Reserved
11	TAB				Normal
12	LF				Normal
13	Normal				Reserved
14	FF				Normal
15	CR				Normal
16-37	Normal				Reserved
40-176	Normal				Normal
177	ESCAPE				Normal

Normal means the definition of this byte in  the current font will be
printed.  If this byte is  undefined in the current  font, it will be
ignored.

ESCAPE causes the next  byte to  have an  alternate meaning  selected
from the column "Escape significance".

TAB produces  a column  select to  the column which  is at  least the
width  of a blank  to the right  of the current  column position, and
some multiple of 8 blank widths to the right of the left margin.

LF activates the current  text line. The current text  will be queued
to printed.   The default Y position of text  will be advanced by the
number of scanlines it  takes to draw this  line, plus the number  of
lines specified  by the  interline space argument  to the  margin set
MTAPE.   This default Y position will be  used for the next text line
(unless changed by a vector command or ESCAPE-3.

FF, like  LF, activates  the text.   In  addition, FF  causes a  page
eject  after the  current text  line is  printed.   FF also  sets the
defalut Y position to the first line below the top of page  margin on
the new page.

CR  causes  a  column  select  to  the  current  left  margin  to  be
generated.

XGP ESCAPE  1 ('177&'001) causes  the next  7 bits  to be  read as  a
special operation code.  The following codes are implemented:

	0-17	Font select.
		The code, 0 to 17 is taken as the font identification
		number of the font to use.

	20-37	Reserved for future use.

	40	XGP Column Selector
		The  next  14  bits  are taken  modulo  4096  as  the
		x-position to print  at next.  (The  intention  is to
		allow arbitrary width spaces for text justification.)

	41	XGP Underscore
		The next byte (in two's complement)  is  the relative
		scan line  on which the underscore is to occur, where
		0  represents  the  baseline  of  the  text, negative
		values   represent   lines  above  the  baseline  and
		positive  values  lines  below  it.  The next 14 bits
		(modulo 4096) specify the length of  the  underscore.
		(If  the  underscore command is the first thing on  a
		line, the baseline will be set to the baseline of the
		current font.)

	42	Line space.
		This does  a line feed and then takes the byte as the
		number of blank scan lines to insert before  the next
		line.

	43	Base-line adjust.
		The next  7 bits are taken in two's complement as the
		base-line adjustment  to  the  current  font.     The
		adjustment sticks  until  reset  by  another   adjust
		command or a font select. The intention is to allow a
		font to be  used  for  subscripts  and  superscripts.
		(Increment baseline  for  superscript,  decrement for
		subscript).  

	44	Print the paper page number.
		The paper page number is set to 1 by a form feed.  It
		is  incremented  each  time  the  paper  is cut.  The
		decimal value of this count is printed.

	45	Accept heading text.
		The next  byte  is a  count of bytes to follow. Those
		bytes  will be read into the heading line.  When that
		count is exhausted, the heading line will be printed.
		If a line feed or line space command  is  given  that
		would cause text to be printed below the current text
		area,  a  form  feed  is inserted by the XGP and if a 
		heading is defined, it will be printed.

	46	Start Underline.
		Set the left end of an underline. See Stop Underline.

	47	Stop Underline.
		The  next byte is the scan line on which to write the
		underline (same as XGP Underscore).   The  extent  of
		the underscore is defined by this command  and  Start
		Underline. If this command is not preceded by a Start
		Underline, the results will be unpredictable.  Beware
		of column selects.  No  underline  will  happen until 
		this command is given.
	
	50	Accept following byte as the intercharacter space. This
		is NOT implemented at Stanford and is included for
		compatibility with MIT.

	51	Stop Underline.  Like '177&'1&'47, but the first byte
		following the '51 sets the line thickness of the underscore.

XGP ESCAPE 2  ('177&'002) causes the next 7  bits to be taken  as the
column  increment.    This  quantity  is  signed: 0-77  are  positive
increments 100 to 177 are negative increments (100 → -100, 177 → -1).

XGP ESCAPE 3 ('177&'003) causes  the next 2 bytes to be  taken as the
scan line  number on which to  start this text line.   Scan line 0 is
the first  scan line  on the  page (immediately  following the  cut).
The topmost scanline  of the present text line will  be placed on the
scan  line indicated in this  command.  (If there  is no current text
line, the next text line will be put there.)

XGP ESCAPE 4 ('177&'004).   This escape is used to  specify a vector.
It is followed by 11 bytes describing the vector:

	2 bytes	Y0	Scan line number of first line of vector.
	2 bytes X0	Column  position of left  edge of first  line
			of the vector.
	3 bytes DX	Delta X. 1 bit of sign; 11  bits  of integer;
			9 bits of fraction.
	2 bytes N	The number of scan lines on which this vector
			is visible.
	2 bytes W	The column width of each scan-line.

The  XGP   service  must   be  presented   with  vectors  sorted   by
ascendending  values  of Y0.   If  the  vectors are  not  sorted, the
output will be wrong.

The escape significance  of codes 5 through  10,  13, and  16 through
37 is not defined at the present time but reserved for future use.
	XGP MTAPE UUO

	The MTAPE uuo is used to provide  extended control and status
reporting  of  the XGP.   MTAPE  is  not synchronized  with  the data
stream  except  that   certain  MTAPEs   imply  CLOSE  before   their
operation.

	MTAPE CHAN,ADR where CHAN is  the channel number on which the
XGP has been opened is interpreted as follows:

	ADR  contains the operation selector.   The data at ADR+1 and
following depends on the operation selected.

Operation

0		Return error status.
		ADR+1/	major error code
		ADR+2,3,4/ error data

1		Font selection.
		ADR+1/ Font file name in sixbit
		ADR+2/ Font extension
		ADR+3/ PPN of font file
		ADR+4/ font identification number. (0 to 15.)
		(This UUO will skip if there is no error).

		The font named will be read by the font compiler.  It
		will be assigned the font  identification number that
		is supplied.  The  identification number is used only
		by the Font selection operator.

2		Read Margins
		ADR+1/ Top of page margin
		ADR+2/ Page body size
		ADR+3/ Bottom of page margin.
		ADR+4/ Left margin
		ADR+5/ Right side margin
		ADR+6/ Minimum interline space

3		Set Margins
		ADR+1/ Top of page margin		<37777
		ADR+2/ Page body size			<37777
		ADR+3/ Bottom of page margin.		<37777
		ADR+4/ Left Margin			< 3777
		ADR+5/ Right side margin. 		Left < Right < 7777
		ADR+6/ Minimum interline space		< 3777

		Note that if the bottom of  page  margin  is set to 0
		there will not be any paper cuts.

4		Get status
		ADR+1/ XGPIOS the entire device status word
		ADR+2/ -1 if there is a data transfer in progress,
			otherwise 0.

5		Pseudo Close.

6		Set node counts.
		ADR+1/Number of text nodes (default is =16)
		ADR+2/Number of vector nodes (default is =100)

		If either node count is zero, the default is used.
		The number of nodes needed increases with the complexity
		of the text that is printed.  Font changes and overlapping
		text lines all require additional space in the text nodes.
		A vector nodes is required for each currently active vector.
		There is no reason to suppose that the PDP6 can process
		any more than 100 vectors simultaneously.  However, in
		unusual cases, incresing the number of text nodes may permit
		text to be processed successfully.
	XGP error reporting.

Status Bits

IOIMPM	400000	Illegal Mode				[7]
		PDP-6 Not responding (Hung timeout)	[6]

IODERR	200000	PDP-6 detected Error
			¬XGPOK				[6]
			Buffered mode data miss		[5]
			Line too complex		[10]
			Out of Order			[11]
			Missed				[12]
			Page Too Long			[13]
			Illegal Vector			[14]


IODTER	100000	Font Compiler Lossage			[1] [2] [3] [4]


Further information can be obtained from the MTAPE uuo.

Major error	Meaning
0		No error

1		Font Compiler lossage; No job slots

2		Font Compiler lossage; No initial response

3		Font Compiler lossage; No intermediate response

4		Font Compiler lossage; Illegal Response
		  ADR+2 contains the FC response:
		    0	Ready
		    1	Allocation Made
		    2	Compilation done
		    3	Font compiler error:
			ADR+3 is error type:
			  0	illegal command
				ADR+4 is the rejected command
			  1	Not enough Core
			  2	Lookup Failure
			  	ADR+4 is the lookup status code
			  3	File error - unexpected eof
				ADR+4 is the last character processed
			  4	File error - character redefined
				ADR+4 contains last character processed
			  5	Disk error
			  6	Logical Font number too large
			  7	File error - other illegal format
				ADR+4 contains last character processed

5		I-level data missed in buffered mode

6		XGP Hung timeout

7		Illegal mode.

10		Line too Complex.  The line compiler ran out of room
		while compiling a text line.

11		Out of Order.  Y0 of a vector or text line is smaller
		than the last item (either vector or text) that was
		queued.  That is, the input was not properly y-sorted.

12		XGPSER missed.  Somehow, the system has failed to start
		a vector or text node at the right place.  Possibly there
		are too many vectors.  ADR+2 is the current scan-line.
		ADR+3 is the scan line desired.  XGPSER cannot sucessfully
		queue text or vectors on scanline 0 of the first page of
		any transfer.

13		Page too Long.  You started a vector below the bottom
		of a page.

14		Illegal Vector Parameters.  A vector you specified will
		go off the page. 
     	XGPUUO	UUO

	The XGPUUO UUO is of interest only  to the Font Compiler (and
to  the Department  of Redundancy  Department).  If  you are  not the
Font Compiler, this UUO is a no-op. 

	If you are the Font Compiler, then:

	MOVE	AC,[CSB,,NSB]
	XGPUUO	AC,
	<return here>

CSB  and NSB  are  the addresses  of  20 word  blocks.   CSB  is  the
Currrent Status  Block.  The Font compiler  reports it's state to the
system by the data it  puts in the CSB  before giving this UUO.   NSB
is  the New  Status Block.  The system  issues commands  to the  Font
Compiler by  the data it stores in the NSB when returning to the Font
Compiler from this UUO.

	If the  system doesn't have  any work  for the Font  Compiler
when  this UUO is  executed, the Font  Compiler will be  made to wait
until the system has another command for it..

The current specification of the system-Font Compiler interface is:

The first word of the block is the op code. All subsequent words are
operands. 

OP	TO FC				FROM FC

0	KILL NOW			NO-OP (READY)
	(XGPSER IS FINISHED WITH
	FC)

1	ALLOCATE			ALLOCATION MADE
	(ARGUMENT IS SIZE		(ARGUMENT IS LOCATION
	TO ALLOCATE)			OF ALLOCATION)

2	COMPILE				FINISHED COMPILING
	(FILE NAME,EXT,PPN		(ARGUMENT IS LOCATION OF
	ARE IN 3 CONSECUTIVE		BASE TABLE)
	WORDS, FOLLOWED BY
	A WORD WITH LOGICAL 
	FONT NUMBER (0-17).

3	LOCKIN				COMPILER ERROR
	(TIME TO LOCK IN CORE		ARGUMENT IS ERROR CODE
	BECAUSE WE WANT TO SEND
	DATA)


ERROR CODES:
0	ILLEGAL COMMAND. NEXT WORD IS THE REJECTED OPCODE.
1	NOT ENOUGH CORE.
2	LOOKUP FAILURE - FONT FILE WAS NOT FOUND.
			NEXT WORD IS THE LOOKUP STATUS CODE.
3	FILE ERROR-UNEXPECTED EOF.
4	FILE ERROR-REDUNDANT CHARACTER
5	DISK ERROR
6	LOGICAL FONT NUMBER TOO BIG.
7	FILE ERROR-OTHER ILLEGAL FORMAT